<html>

	<head>
            <link rel="stylesheet" type="text/css" href="scripts/prueba.css"/>
	</head>

	<body>

		<div class="pcpal">
                <div class="menu">
                <?php
                    require_once("scripts/Menu.php");
                ?>
                </div>
                <div class="content1">
                    <img src="/AppResiduos2/images/6331380.jpg" alt="energia" style="width: 800px; height: 320px;" align="middle">
                </div>
                <div class="content2">

                <form action="/AppResiduos2/control/ResiduoControl.php" method="post">
	<?php if (isset($_POST['newResidue'])){
                require_once("/var/www/AppResiduos2/lib/dao/EmpresaDAO.php");
                $pDAO = new EmpresaDAO();
                $prod = $pDAO->listarProductores();
        ?>
			<input type="hidden" name="operation" value="newResidue">
                        <table id="others">
                            <tr class="alt2">
                                <td>
                                    Residue's producer:
                                </td>
                                <td>
                                    <select size="1" name="residue_producer">
                    <?php


                                    for($i = 0; $i < sizeof($prod); $i = $i + 1){

                    ?>
                                    <option selected value=<?php print_r($prod[$i]->name);?>><?php print_r($prod[$i]->name);?> </option>

                    <?php
                                    }
                    ?>
                                    </select>
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's id:
                                </td>
                                <td>
                                    <input type="text" name="residue_id" value="<?php print_r($prod[$i]);?>"> 
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's name:
                                </td>
                                <td>
                                    <input type="text" name="residue_name">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's toxicity:
                                </td>
                                <td>
                                    <select size="1" name="residue_toxicity">
                    <?php
                                    for($i = 1; $i <= 10; $i = $i + 1){

                    ?>
                                    <option selected value=<?php echo $i;?>><?php echo $i;?> </option>

                    <?php
                                    }
                    ?>
                                    </select>
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's type of transport:
                                </td>
                                <td>
                                    <input type="text" name="residue_typetransport">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's quantity:
                                </td>
                                <td>
                                    <input type="text" name="residue_quantity"> 
                                </td>
                            </tr>
                         
	<?php
		}
		if (isset($_POST['modifyResidue'])){
                    $id_residue = $_POST['id_residue'];
                    $id_producer = $_POST['id_producer'];
                    $name_residue = $_POST['name_residue'];
                    $quantity_residue = $_POST['quantity_residue'];
	?>
			<input type="hidden" name="operation" value="modifyResidue">
                        <input type="hidden" name="id_residue" value="<?php echo $id_residue; ?>">
                        <input type="hidden" name="id_producer" value="<?php echo $id_producer; ?>">
                        <table id="others">
                            <tr class="alt2">
                                <td>
                                    Residues's name:
                                </td>
                                <td>
                                    <input type="text" disabled="true" name="residue_name" value="<?php echo $name_residue ?>">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    Residue's quantity:
                                </td>
                                <td>
                                    <input type="text" disabled="true" name="residue_quantity" value="<?php echo $quantity_residue ?>">
                                </td>
                            </tr>
                            <tr class="alt2">
                                <td>
                                    New residue's quantity:
                                </td>
                                <td>
                                    <input type="text" name="new_residue_quantity">
                                </td>
                            </tr>

	<?php
		}
		if (isset($_POST['deleteResidue'])){
		$id_residue = $_POST['id_residue'];
                $id_producer = $_POST['id_producer'];
                $name_residue = $_POST['name_residue'];
	?>
			<input type="hidden" name="operation" value="deleteResidue">
                        <input type="hidden" name="id_residue" value="<?php echo $id_residue; ?>">
                        <input type="hidden" name="id_producer" value="<?php echo $id_producer; ?>">
                        <table id="others">
                            <tr class="alt2">
                                <td>
                                    Residue's name:
                                </td>
                                <td>
                                    <input type="text" disabled="true" name="residue_name" value="<?php echo $name_residue ?>"> 
                                </td>
                            </tr>
			 
	<?php
		}
	?>
                            <tr class="alt2">
                                <td></td>
                                <td>
                                    <input type="submit" value="Accept">
                                </td>
                            </tr>
                        </table>

		</form>
		</div>
                </div>
	</body>

</html>
